package org.myorg.v3;

public class FF33 extends Fc3 {
	public FF33() {

		low = -5;
		high = 5;
		best = Double.NEGATIVE_INFINITY;
	}

	public double fc(double[] tmp) {
		double y = 0;
		
		double n = tmp.length;
		double tmp1 = 0;
		double tmp2 = 0;
						
		for (int i = 1; i < n; i++ ) {
			tmp1 = tmp1 + tmp[i]*tmp[i];
			tmp2 = tmp2 + Math.cos(2*Math.PI*tmp[i]);
		}
		
		double d0 = tmp1/n;
		double d1 = Math.sqrt(tmp1/n);
		double d2 = Math.exp(-0.2*Math.sqrt(tmp1/n));
		
		y = -20 * Math.exp(-0.2*Math.sqrt(tmp1/n)) - Math.exp(tmp2/n) + 20 + Math.E; 
		
		return y;
	}
}
